package com.itheima.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Demo5Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext context = getServletContext();
        String contextPath = context.getContextPath();
        System.out.println(contextPath);
        String realPath = context.getRealPath("/");//web资源的根路径，发布后war的web目录
        System.out.println(realPath);
        String realPath1 = context.getRealPath("/c.txt");
        System.out.println(realPath1);
        String realPath2 = context.getRealPath("/WEB_INF/classes/a.txt");
        System.out.println(realPath2);
        context.setAttribute("url","www.oracle.com");

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
/*
doget 与dopost的get与post获取，发送
声明，映射
/代表全部？/*呢
servletConfig的迭代器next原理

应用域大小
 */